import axios from 'axios'
import Ls from './localstorage.js'

axios.defaults.withCredentials = true

axios.defaults.headers.common = {
  'X-Requested-With': 'XMLHttpRequest',
}

/**
 * Interceptors
 */

axios.interceptors.request.use((config) => {
  // Pass selected company to header on all requests
  const token = Ls.get('token')
  // config.headers.common['Authorization'] = "Bearer " + token ?? ''
  config.headers.Authorization = "Bearer " + token ?? ''

  // 地址
  //config.url = 'http://127.0.0.1:8123'+config.url
  return config
})
